﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YasharEl.Infrastructure.ResourcesManagement;
using System.Runtime.Serialization;
using System.Globalization;

namespace YasharEl.Infrastructure.TaskEngine
{
    [Serializable]
    public class TaskActionNotFoundException : TranslatedDomainModelException
    {
        private const string TaskActionNotFoundExceptionKey = "TaskActionNotFoundException";

        private readonly long _taskActionId;

        public long RequestedTaskActionId
        {
            get { return _taskActionId; }
        }

        public TaskActionNotFoundException(IResourceManager resourceManager, long taskActionId)
            : base
                (
                resourceManager,
                string.Format(
                    resourceManager.GetString(TaskActionNotFoundExceptionKey, CultureInfo.GetCultureInfo("en")),
                    taskActionId
                )
                )
        {
            _taskActionId = taskActionId;
        }

        protected TaskActionNotFoundException(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
        }

        protected override string ExceptionMessageResourceKey
        {
            get { return TaskActionNotFoundExceptionKey; }
        }

        public override string TranslatedMessage
        {
            get
            {
                return string.Format(resourceManager.GetString(ExceptionMessageResourceKey), RequestedTaskActionId);
            }
        }
    }
}
